package com.springboot.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/test")
public class HelloworldController {

    @RequestMapping("/sayhello.html")
    public @ResponseBody String say(){
        return "hello world";
    }

    @RequestMapping("/say.html")
    public @ResponseBody String say(String name){
        return "hello world "+name;
    }

    @RequestMapping("/index.html")
    public String say(Model model){
        model.addAttribute("name","hello world");
        return "/index.btl";
    }

    @RequestMapping("index.json")
    public @ResponseBody String sayHello(){
        return "Hello, world!";
    }
}
